﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SeriesThequeMVVM.Windows;
using System.ComponentModel.DataAnnotations;

namespace SeriesThequeMVVM.DesktopClient.ViewModels
{
    class UserViewModel : ViewModel
    {
        private string userLogin;
        [Required]
        public string UserLogin 
        {
            get {return userLogin;   }
            set
            {
                userLogin =  value; 
                NotifyPropertyChanged(); 
            }
        }

        protected override string OnValidate(string propertyName)
        {
            if ( UserLogin != null && userLogin.Length < 5)
            {
                return "Login must be greater than or equal to 5 charchters";
            }
            return base.OnValidate(propertyName);
        }
    } 
}
